package com.mfh.auto.create.mvvm.autocreatemvvm.file.v2

import com.intellij.psi.PsiDirectory
import com.mfh.auto.create.mvvm.autocreatemvvm.Config
import com.mfh.auto.create.mvvm.autocreatemvvm.file.BaseFileModel
import com.mfh.auto.create.mvvm.autocreatemvvm.utils.CreateFileUtils

object ViewModelFileModelV2 : BaseFileModel() {

    override fun buildFileName() = "${Config.name}ViewModel.kt"

    override fun buildContentString(directory: PsiDirectory): String {
        return buildString {
            appendLine("package ${CreateFileUtils.getPackageByDirectory(directory)}")
            appendLine()
            appendLine("import android.content.Intent")
            appendLine("import android.content.Context")
            appendLine("import ${Config.libPackageNameV2}.base.BaseViewModel")
            appendLine()
            appendLine("/**")
            appendLine(" * @desc: ${Config.desc}")
            appendLine(" */")
            appendLine("class ${Config.name}ViewModel : BaseViewModel() {")
            appendLine()
            appendLine("    override fun initContext(context: Context, intent: Intent) {")
            appendLine("        super.initContext(context, intent)")
            appendLine("        // TODO:")
            appendLine("    }")
            appendLine()
            appendLine("}")
        }
    }

}